package com.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class readArr {
    public static int[][] read(){
        System.out.println("读取磁盘的数据中~~~~~~");
        File file = new File("d:\\sparse.txt");
        int[][] sparseArr = null;
        try {
            BufferedReader br = new BufferedReader(new FileReader(file));
            if (!file.exists()) {
                file.createNewFile();
            }
            String row = br.readLine();
            String[] s = new String(row).split("\t");
            sparseArr = new int[Integer.parseInt(s[0])][Integer.parseInt(s[1])];
            while ((row = br.readLine()) != null) {
                String[] s2 = new String(row).split("\t");
                sparseArr[Integer.parseInt(s2[0])][Integer.parseInt(s2[1])] = Integer.parseInt(s2[2]);
            }
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return sparseArr;
    }
}
